<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
  <style>
    .box2,
    .box3 {
      height: 80px;
      width: 80px;
      border: 1px solid red;
    }

    .box1>,
    .box2 {
      background-color: aqua;
    }

  </style>
</head>

<body ng-app="myApp">
  <div class="box1">
    <div class="box2"></div>
  </div>
  <div class="box2"></div>
  <div ng-controller="myCtrl">
    <form class="searchBar">
      <button type="submit" onclick="submit1Search()" class="btn btn-default">提交</button>
    </form>
    <input type="text" ng-keyup="enterEvent($event)" ng-model="searchKey">
  </div>

  <script>
    function submit1Search() {
      alert()
    }
    angular.module('myApp', [])
      .controller('myCtrl', ['$scope', function ($scope) {
        // 关键字搜索
        $scope.keySearch = function () {
          alert("回车事件")
        };
        $scope.enterEvent = function (e) {
          var keycode = window.event ? e.keyCode : e.which;
          if (keycode == 13) {
            $scope.keySearch();
          }
        };
      }]);
  </script>
</body>

</html>